package com.yjhb.android.sbz.tool;

import android.content.Context;

import com.duoyou.ad.openapi.DyAdApi;
import com.yjhb.android.sbz.App;
import com.yjhb.android.sbz.R;
import com.yjhb.android.sbz.manager.OAIDManager;

/**
 * 创建者 zx
 * 创建时间 2020/9/7 10:41
 */
public class DYTool {
    private static DYTool dyTool;
    private Context context;

    public static void init(Context context) {
        dyTool = new DYTool(context);
    }

    private DYTool(Context context) {
        this.context = context;
        DyAdApi.getDyAdApi().setOAID(context, OAIDManager.getInstance().getOaid());
        DyAdApi.getDyAdApi().init("dy_59634787", "44f983c3c7763d486d93b45316a444b0");
        DyAdApi.getDyAdApi().setTitleBarColor(R.color.colorPrimaryDark);
    }

    public static DYTool getInstance() {
        if (dyTool == null) throw new RuntimeException("请初始化DYTool");
        return dyTool;
    }


    public void startList() {
        if (Tool.checkLogin(context)) {
            //0（默认值）显示全部数据  1.手游  2.棋牌游戏
            DyAdApi.getDyAdApi().jumpAdList(context, App.userInfo.getId(), 0);
        }
    }

    public void startDetailPage(String advert_id) {
        if (Tool.checkLogin(context)) {
            DyAdApi.getDyAdApi().jumpAdDetail(context, App.userInfo.getId(), advert_id);
        }
    }



}
